import ajax from '../../utils/ajax.js'
const form = document.forms.indexLogin;
form.onsubmit = async function (e) {
    e.preventDefault()
    const result = await ajax("post", "/api/manage/login", {
        uid: form.uid.value,
        pwd: form.pwd.value
    })
    // console.log(result);

    if (result.flag) {

        alert('登录成功')
        //token存储到本地
        localStorage.setItem('token', result.token)
        //跳转页面
        location.assign('index.html')
    } else {
        // console.log(result);
        // console.log(result.flag);
        alert('用户名或密码错误!!!!')
    }
}